<?php defined('IN_IA') or exit('Access Denied');?><script type="text/javascript">


    //导航栏选中

    function  indexofleftdatda($str,findstr) {
        var $navurl=$str;
        var navstart=  $navurl.indexOf(findstr);
        var navparalen= $navurl.length-navstart;
        var navstrpara =  $navurl.substring(navstart,$navurl.length)

        return navstrpara;
    }
    var  navstrpara= indexofleftdatda(location.href,"?")
    $(".we7-page-tab").find("a").each(function () {

        if(navstrpara.indexOf(indexofleftdatda($(this).attr("href"),"?"))>-1){
            $(this).parent().addClass("active");
            return false;
        }
    })




    // NProgress
    if (typeof NProgress != 'undefined') {
        $(document).ready(function () {
            NProgress.start();
        });

        $(window).load(function () {
            NProgress.done();
        });
    }
    $('.js-switch').each(function () {
        if ($(this).attr("data-value") != "-1") {
            $(this).attr("checked", "checked")
        }

        var elem = $(this).get(0);
        var init = new Switchery(elem);


    });
//    var elem = document.querySelector('.js-switch');
//    var init = new Switchery(elem);

    //处理select
    $("#xc_form").find("select").each(function () {

        if ($(this).attr("data-select") != "") {
            $(this).val($(this).attr("data-select"));
        }
    })

    $(".js-select2").select2({  language:'zh-CN', theme: "bootstrap"});
    //多图排序
    $(".multi-img-details").sortable();

    $('.xradio').each(function () {
        if ($(this).attr("data-value") != "-1" || $(this).attr("data-value") != "") {
            var aselctobj = $(this).find("[type='radio'][value='" + $(this).attr("data-value") + "']");
            aselctobj.attr("checked", "checked");
            aselctobj.siblings().removeAttr("checked");
        }
    })

    var xpagecss = {
        xload: function () {
            swal({
                title: "操作中",
                text: "",
                imageUrl: "../addons/<?php  echo $_GPC['m']?>/resource/images/xload1.gif",
                showConfirmButton: false,
                allowOutsideClick: true
            });
        },
        close: function () {
            swal.close();
        }
    }

    var replyrdata = {};
    replyrdata[1] = "success";
    replyrdata[-1] = "error";
    replyrdata[2] = "warning";
    replyrdata[3] = "info";
    replyrdata[4] = "question";
</script>